<?php

defined('MYLITS') ? '' : exit('No direct script access allowed');

/**
 * @version     1.0.0
 * @package     mylits engine
 * @license     GNU General Public License version 3
 * @author      Arfan Fudyartanto D N <arfan@mylits.com> - http://engine.mylits.com
 */
class componentsProcess extends Mylits_Process {

    function __construct() {
        parent::__construct();
        $this->setTemplate('components');
    }

    public function response() {
        $componentsModel = $this->loadModel('components');

        $dir = APP_DIR . 'components/';
        $components = array();
        if ($handle = opendir($dir)) {
            while (false !== ($entry = readdir($handle))) {
                if ($entry != "." && $entry != "..") {
                    if(is_dir($dir . $entry)){
                        $components[] = $entry;
                    }
                }
            }
        }
        $urlEdit = BASE_URL . $this->getComponentName() . '/view.edit/';
        closedir($handle);
        
        return compact('components', 'urlEdit');
    }

}

?>
